from django.db import models

# Create your models here.

class Subject (models.Model):
    subject_id = models.IntegerField(primary_key=True)
    name = models.CharField(max_length=140)

    class Meta:
        db_table = "subjects"

class Group (models.Model):
    group_id = models.IntegerField(primary_key=True)
    name = models.CharField(max_length=10)

    class Meta:
        db_table = "groups"

class Lesson (models.Model):
    lesson_id = models.IntegerField(primary_key=True)
    day  = models.IntegerField()
    common = models.IntegerField()
    even = models.IntegerField()
    group = models.ForeignKey(Group, db_column='group_id')
    position  = models.IntegerField()
    subject = models.ForeignKey(Subject, db_column='subject_id')

    class Meta:
        db_table = "lessons"
        ordering = ["group"]